function openInsertTable(rteID){
  try{
    window.insertTableInto=rteID;
    wnd=pop_up('/object.inserttable','577','178');
  }catch(e){
    alert("openInsertTable:"+e.message);
  }
}

function insertTableInsert(){
  try{
    var cols=getElement("cols").value;
    var rows=getElement("rows").value;
    var border=getElement("border").value;
    var padding=getElement("padding").value;
    var spacing=getElement("spacing").value;
    var html="<table border=\""+border+"\" cellpadding=\""+padding+"\" cellspacing=\""+spacing+"\">";
    var col=0;
    var row=0;
    var idx=1;
    for(row=0;row<rows;row++){
      html+="<tr>";
      for(col=0;col<cols;col++){
        html+="<td>"+(idx++)+"</td>";
      }
      html+="</tr>";
    }
    html+="</table>";
    rteID=window.opener.insertTableInto;
    if(rteID&&(window.opener.document.getElementById(rteID))&&(oRTE = window.opener.document.getElementById(rteID).contentWindow)){
      oRTE.focus();
      if(isGecko){
        oRTE.document.execCommand('inserthtml', false, html);
      }else{
        var rng = oRTE.document.selection.createRange();
        if (rng.item){
          rng.item(0).outerHTML = html;
        }else{
          rng.pasteHTML(html);
        }
      }
      oRTE.focus();
    }
    window.close();
  }catch(e){
    alert("insertTableInsert:"+e.message);
  }
}

function insertTableCancel(){
  try{
    window.close();
  }catch(e){
    alert("insertTableCancel:"+e.message);
  }
}